package com.mkh.st.admin.feign;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.mkh.st.admin.api.entity.SysOauthClientDetails;
import com.mkh.st.admin.api.feign.IClientDetailsProvider;
import com.mkh.st.admin.service.SysOauthClientDetailsService;
import com.mkh.st.common.core.util.R;
import com.mkh.st.common.security.annotation.Inner;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@AllArgsConstructor
public class ClientDetailsProvider implements IClientDetailsProvider {

	private final SysOauthClientDetailsService clientDetailsService;

	@Override
	@Inner(false)
	@GetMapping("/client/provider/getClientDetailsById/{clientId}")
	public R<SysOauthClientDetails> getClientDetailsById(@PathVariable("clientId") String clientId) {
		return R.ok(clientDetailsService.getOne(
				Wrappers.<SysOauthClientDetails>lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId), false));
	}
}
